﻿using Jay.Sc2.Bof.Lib.State;

namespace Jay.Sc2.Bof.Lib.Action.Zerg
{
	public abstract class ActionProduceZerg : ActionProduce
	{
		public ActionProduceZerg(int buildTime, int minerals, int gas, int food) : base(buildTime, minerals, gas, food) { }
		public override bool IsInvalid(IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			if (bo.State.Minerals < Minerals && bo.State.WorkersOnMinerals == 0) return true;
			if (bo.State.Gas < Gas && bo.State.WorkersOnGas == 0) return true;
			if (!(bo.State.HaveSupply(Food) || (bo.State.SupplyBuilding + bo.State.Supply >= bo.State.Food + Food))) return true;
			return false;
		}
	}
}
